<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>资源管理</title>
    <%@include file="/WEB-INF/jsp/common/meta2.jsp" %>
</head>
<body class="content-body">
<div class="container-fluid">

    <table class="table table-responsive table-bordered">
        <tr>
            <th colspan="20" class="bg-info text-center">内容列表</th>
        </tr>
        <tr>
            <td colspan="20">
                <form id="listForm" action="${ctx}/common/resource/list" method="get" class="form-inline" role="form">
                    <input type="hidden" name="pageNo" id="pageNo" value="${pageData.pagination.pageNo}"/>
                    <input type="hidden" name="pageSize" id="pageSize" value="10"/>
                    <input type="hidden" name="ascDesc" id="ascDesc" value="${pageData.ascDesc}"/>
                    <input type="hidden" name="orderName" id="orderName" value="${pageData.orderName}"/>

                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">资源组：</div>
                            <select name="EQ_I&group_id" class="form-control input-sm">
                                <option value="0">-全部-</option>
                                <c:forEach items="${groups}" var="group">
                                    <option value="${group.id}" ${pageData.webMap['EQ_I&group_id'][0] == group.id ? 'selected':''}>
                                            ${group.name}
                                    </option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">资源名称|URL：</div>
                            <input type="text" name="LIKE_S&name_OR_url" placeholder="资源名称|URL"
                                   class="input-sm form-control"
                                   value="${pageData.webMap['LIKE_S&name_OR_url'][0]}">
                        </div>
                    </div>
                    <input type="button" onclick="search()" value="查询" class="btn btn-info btn-sm">

                    <a href="${ctx}/common/resource/new" class="btn btn-info pull-right btn-sm">添加资源</a>
                </form>
            </td>
        </tr>
        <tr class="bg-info">

            <%--<th>#</th>--%>
            <th class="text-center" onclick="sort('icon')">图标</th>
            <th onclick="sort('name')">资源名称</th>
            <th onclick="sort('url')">URL</th>
            <th onclick="sort('group_id')">资源组</th>
            <th onclick="sort('enable')">禁用</th>
            <th onclick="sort('is_menu')">菜单项</th>
            <th onclick="sort('order')">组内序号</th>
            <th class="text-center">操作</th>
        </tr>
        <c:forEach items="${pageData.result}" var="entity" varStatus="i">
            <tr>
                    <%--<td class="center">--%>
                    <%--${i.index + 1}--%>
                    <%--</td>--%>
                <td class="text-info text-center">
                   <span id="iconBar"
                         class="glyphicon ${entity.icon != null && fn:containsIgnoreCase(entity.icon, 'glyphicon') ?entity.icon: 'glyphicon-list-alt'}"></span>
                </td>
                <td class="center">
                        ${entity.name}
                </td>
                <td>
                        ${entity.url}
                </td>
                <td>
                        ${entity.group.name}
                </td>
                <td class="center">
                        ${entity.enable ? '是':'否'}
                </td>
                <td class="center">
                        ${entity.isMenu?'是':'否'}
                </td>
                <td class="center">
                        ${entity.order}
                </td>

                <td class="text-center">
                    <a href="${ctx}/common/resource/edit/${entity.id}">编辑</a>|
                    <a href="javascript:doDelete('${ctx}/common/resource/delete/${entity.id}');">删除</a>
                </td>
            </tr>
        </c:forEach>
        <c:if test="${fn:length(pageData.result) < 1}">
            <tr>
                <td colspan="20">无数据...</td>
            </tr>
        </c:if>
    </table>


    <%@include file="/WEB-INF/jsp/common/pager.jsp" %>
</div>
</body>
</html>
<script>

    function doDelete(url) {
        if (confirm("确定执行该操作？")) {
            location.href = url;
        }
    }

</script>
